#ifndef _FRACTAL_LSYSTEM_H_
#define _FRACTAL_LSYSTEM_H_


#include <string>
#include <vector>
#include "../fvertexarray.hpp"


using std::string;
using std::vector;


struct LSysRule
{
    char from;
    string to;

    LSysRule(void);
    LSysRule(char from, const char *to);
    LSysRule(char from, const string &to);
};


struct LSystem
{
    int age;
    double step;
    double angle;
    string axiom;
    vector<LSysRule> rules;

    LSystem(void);
    LSystem(int age, double step, double angle,
              string axiom, vector<LSysRule> &rules);
    
    int vertex_num(void);
    void render(FVertexArray<FVector2d > &va);

private:
    void _gen_str(string &dest);
    int _find_rule_for(char c);
};


#endif  // _FRACTAL_LSYSTEM_H_
